#include<iostream>
#include<deque>//双端队列
#include<string>
#include<cstdio>
using namespace std;

void myPrint(deque<int> a)
{
	for(deque<int>::iterator it = a.begin();it!=a.end();it++)
	{
		cout<<(*it)<<" ";
	}
	cout<<endl;
}

int main()
{
	deque<int> s(10,1);
	
	//与vector操作类似
	s.insert(s.begin()+1,3,6);
	s.push_back(5);//在队尾插入元素
	s.push_back(10);
	s.pop_back();
	s.push_front(8);//在队首插入元素
	s.push_front(99);
	s.pop_front();
	s.erase(s.begin()+5,s.end()-1);
	cout<<s.size()<<endl;
	myPrint(s);
	cout<<s.front()<<" "<<s.back()<<endl;
	
	return 0;
}